import request, { scope } from '../../utils/request';

const userUrl = scope('user/order');

export const addOrder = (userId, total, allCount, userAddressId, products) => {
  return request({
    url: userUrl('save'),
    method: 'post',
    data: {userId, total, allCount, userAddressId, products },
  });
};

export const findOrder = (userId, status, page, size) => {
  return request({
    url: userUrl(`find/${page}/${size}`),
    method: 'post',
    data: {userId, status },
  });
};

export const updateOrder = (id, userAddressId, status) => {
  return request({
    url: userUrl('update'),
    method: 'post',
    data: {id, userAddressId, status },
  });
};
